<?php
/**
 * Created by PhpStorm.
 * User: alex
 * Date: 2018/11/6
 * Time: 下午9:07
 */

namespace BaseBundle\Services;
use BaseBundle\Entity\Article;
use BaseBundle\Model\m_article;
use Symfony\Component\DependencyInjection\ContainerInterface;

class ArticleService extends BaseService
{
    /**
     * @var m_article
     */
    protected $m_model;

    public function __construct(ContainerInterface $container = null)
    {
        parent::__construct($container);
        $this->m_model = new m_article($container);
    }

    /**
     * @param $rule
     * @param $article_class_id
     * @param int $is_limit
     * @param int $is_set_List
     * @return array|mixed
     */
    public function getArticleByArticleClass($rule,$article_class_id, $is_limit = 1, $is_set_List = 1)
    {
        //获取数据
        $rule = array_merge($rule, ['article_class_id' => $article_class_id]);
        return $this->getList($rule, $is_limit, $is_set_List);
    }

    /**
     * @param $rule
     * @param int $is_limit
     * @param int $is_set_List
     * @return array|mixed
     */
    public function getRecommendArticles($rule, $is_limit = 1, $is_set_List = 1)
    {
        $rule = array_merge($rule, ['is_recommend' => 1]);
        return $this->getList($rule, $is_limit, $is_set_List);
    }
}